package com.hc.server.user.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hc.server.user.domain.entity.UserBackpack;
import com.hc.server.common.domain.enums.YesOrNoEnum;
import com.hc.server.user.mapper.UserBackpackMapper;
import org.springframework.stereotype.Service;

/**
 * Created by wdj on 2024/10/17
 */

@Service
public class UserBackpackDao extends ServiceImpl<UserBackpackMapper, UserBackpack> {

    public Integer getCountByValidItemId(Long uid, Long itemId) {
        return lambdaQuery()
                .eq(UserBackpack::getUid, uid)
                .eq(UserBackpack::getItemId, itemId)
                .eq(UserBackpack::getStatus, YesOrNoEnum.NO.getStatus())
                .count();
    }
}
